﻿function Board() {
    this.backgroundImage = document.getElementById("backgroundImage");
    this.canvas = document.getElementById("canvasGame");
    this.svg = document.getElementById("svgGame");
    this.timerText = document.getElementById("tdTime");
    // default


    this.resizeBoard = function () {

        // temporarily setting specifc settings
        // 800 x 488
        this.width = 800;
        this.height = 480;
        this.canvas.style.height = this.height + "px";
        this.canvas.style.width = this.width + "px";
        this.svg.style.height = this.height + "px";
        this.svg.style.width = this.width + "px";
        this.backgroundImage.style.height = this.height + "px";
        this.backgroundImage.style.width = this.width + "px";
    };

    this.setBackgroundImage = function (imageFileName) {
        this.backgroundImage.src = imageFileName;

    };

    this.setBackgroundImagePosition = function () {
        this.width = window.innerWidth; //+ "px"; // how can i reach up?
        this.height = window.innerHeight; // + "px"; // how can i reach up?
    };

    this.setTime = function () {
        this.timerText.innerHTML = game.elapsedTime();
    };

    window.onresize = this.resizeBoard();
    // wrong?
    //    this.setBackgroundImage("mainScreen.jpg");
    this.backgroundImage.onload = this.setBackgroundImagePosition;
    return this;
}  